<?php include './functions.php'; ?>
<html>
    <head>
        <meta charset="UTF-8">
        <link href="style.css" rel="stylesheet" type="text/css"/>
        <title>Web</title>
    </head>
    <body>
        <div class="wrapper">
            <?php
            // put your code here
            $sqlstu = 'select * from students';
            $sqlsta = 'select * from staffs';
            $students = query($sqlstu);
            $staffs = query($sqlsta)
            //var_dump($students);
            ?>
            <div class="title">LIST STUDENTS</div>
            <table>
                <tr>
                    <th>ID</th>
                    <th>NAME</th>
                    <th>DELETE</th>
                    <th>EDIT</th>
                </tr>
                <?php foreach ($students as $student): ?>
                    <tr>
                        <td><?php echo $student['id'] ?></td>
                        <td><?php echo $student['name'] ?></td>
                        <td>
                            <form action="delete.php?id=<?php echo $student['id'] ?>" method="post">
                                <input type="submit" value="Delete">
                            </form>
                        </td>
                        <td>
                            <form action="edit.php?id=<?php echo $student['id'] ?>" method="post">
                                <input type="text" name="editname" id="textfield">
                                <input type="submit" value="edit">
                            </form>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </table>
            <div>
                <h1>Insert database</h1>
                <form id="form1" name="form1" method="post" action="insert.php" onsubmit="checkForm();">
                    <label>ID</label>
                    <input type="text" name="basic_name1" id="textfield" />
                    <label>Name</label>
                    <input type="text" name="basic_name2" id="textfield" />
                    <input type="submit" name="button" id="button" value="Insert" />
                </form>
            </div>

            <div>
                <h1>Finding student</h1>
                <form id="form1" name="form1" method="post" action="finding.php" onsubmit="checkForm();">
                    <label>Name</label>
                    <input type="text" name="namestudent" id="textfield" />
                    <input type="submit" name="button" id="button" value="Finding" />
                </form>

            </div>

    </body>
</html>

